import React from 'react';
import { Button } from 'antd';
import { testApi, testName, testGet4, testGet5 } from '@services/base-layout-service';
const Welcome = () => {
    const testFun = (type) => {
        testApi({ type, random: Math.random() });
    };

    return (
        <div className="content-box" style={{ height: 'calc(100% - 30px)' }}>
            <h1>Hello world!</h1>
            <div>
                <Button className="mr10" onClick={testFun.bind(null, 'common')}>
                    测试接口
                </Button>
                <Button className="mr10" onClick={testFun.bind(null, '404')}>
                    测试接口404
                </Button>
                <Button className="mr10" onClick={testFun.bind(null, '500')}>
                    测试接口500
                </Button>
                <Button className="mr10" onClick={testFun.bind(null, 'timeover')}>
                    测试接口超时
                </Button>
                <Button className="mr10" onClick={testFun.bind(null, '17010')}>
                    测试接口17010
                </Button>
            </div>
            <div style={{ marginTop: '20px' }}>
                <Button
                    className="mr10"
                    onClick={() => {
                        testGet4({ time: 1 });
                    }}
                >
                    get4 - 验证幂等
                </Button>
                <Button
                    className="mr10"
                    onClick={() => {
                        testGet5({ time: 1 });
                    }}
                >
                    get5 - 验证幂等
                </Button>

                <Button
                    className="mr10"
                    onClick={() => {
                        testName();
                    }}
                >
                    testName - 【不验证】幂等
                </Button>
            </div>

            {/**测试精度计算问 **/}
            {
                <div style={{ background: '#fff', color: '#000', padding: '30px' }}>
                    <h2>精度计算测试</h2>
                    <div style={{ display: 'flex' }}>
                        <div style={{ marginRight: '20px' }}>
                            <h3>-- Nubmer特殊转法---</h3>
                            <p style={{ width: '200px' }}>支持至少有一个number,并且其他参数通过Number转换后是合法的number值的运算，加法除外</p>
                            <p style={{ color: 'red' }}>
                                不支持这种写法,这是字符串拼接
                                <br /> '0.3' + 0.1 = {'0.3' + 0.1}
                                <br /> "a"+"b" = {'a' + 'b'}
                            </p>
                            <p> '0.3' -0.1 = {'0.3' - 0.1}</p>
                            <p> '0.3' *0.1 = {'0.3' * 0.1}</p>
                            <p> '0.3' /0.1 = {'0.3' / 0.1}</p>
                            <p> 0/100 = {0 / 100}</p>
                            <p> 100/0 = {100 / 0}</p>
                            <p>'12b'/3 = {'12b' / 3}</p>

                            <p> ('12'*1) + 6 = {'12' * 1 + 6}</p>
                            <p>+'12'+13 = {+'12' + 13}</p>
                            <p>1+ ('13'+) = {1 + +'13'}</p>
                        </div>

                        <div style={{ marginRight: '20px' }}>
                            <h3>---加法---</h3>
                            <p>12 + a = {12 + 'a'}</p>
                            <p> a + b = {'a' + 'b'}</p>
                            <p>0.1+0.2 = {0.1 + 0.2}</p>
                            <p>0.6+0.3 = {0.6 + 0.3}</p>
                            <p>0.435+0.368 = {0.435 + 0.368}</p>
                            <p>10.756+0.364 = {10.756 + 0.364}</p>
                        </div>

                        <div style={{ marginRight: '20px' }}>
                            <h3>---减法---</h3>
                            <p>0.3 - 0.1 = {0.3 - 0.1}</p>
                            <p>0.9 - 0.3 = {0.9 - 0.3}</p>
                            <p>0.435 - 0.3681 = {0.435 - 0.3681}</p>
                            <p>10.75612 - 0.364 = {10.75612 - 0.364}</p>
                        </div>

                        <div style={{ marginRight: '20px' }}>
                            <h3>---乘法---</h3>
                            <p>0.3 * 0.166 = {0.3 * 0.166}</p>
                            <p>0.851 * 0.3 = {0.851 * 0.3}</p>
                            <p>0.435 * 0.1 = {0.435 * 0.1}</p>
                            <p>10.7 * 0.364 = {10.7 * 0.364}</p>
                        </div>

                        <div style={{ marginRight: '20px' }}>
                            <h3>---除法---</h3>
                            <p>45.3/100 = {45.3 / 100}</p>
                            <p>15.1/1000 = {15.1 / 1000}</p>
                            <p>88.15/100 = {88.15 / 100}</p>
                            <p>10.7 / 0.1 = {10.7 / 0.1}</p>
                        </div>
                    </div>
                </div>
            }
        </div>
    );
};
export default Welcome;
